<template>
	<view class="page">
		<view>请选择投诉类型</view>
		<u-radio-group v-model="complainType" placement="row" class="dis fl_w" @change='change'>
			<u-radio :name="1" activeColor="#FBE43F" label="恶意骚扰" class="li"></u-radio>
			<u-radio :name="2" activeColor="#FBE43F" label="私信骚扰" class="li"></u-radio>
			<u-radio :name="3" activeColor="#FBE43F" label="色情" class="li"></u-radio>
			<u-radio :name="4" activeColor="#FBE43F" label="谩骂攻击" class="li"></u-radio>
			<u-radio :name="5" activeColor="#FBE43F" label="侵犯他人权利" class="li"></u-radio>
			<u-radio :name="6" activeColor="#FBE43F" label="涉嫌诈骗" class="li"></u-radio>
		</u-radio-group>
		<view class="btn" @click="save">
			匿名提交
		</view>
	</view>
</template>

<script>
	import {
		complainAdd
	} from '@/api.js'
	export default {
		data() {
			return {
				complainType: null,
				id: ''
			}
		},
		onLoad(opt) {
			if (opt.id) {
				// 投诉的内容ID
				this.id = opt.id
			}
		},
		methods: {
			async save() {
				let res = await complainAdd({
					contentId: this.id,
					complainType: this.complainType
				})
				if (res.code == 200) {
					uni.showToast({
						icon: 'none',
						title: '投诉成功'
					})
					setTimeout(() => {
						uni.navigateBack()
					}, 2000)
				}
			},
			change(e) {
				console.log('e', e);
			},
		}
	}
</script>

<style scoped lang="scss">
	.page {
		width: 750rpx;
		box-sizing: border-box;
		min-height: 100vh;
		padding: 30rpx;

		.fl_w {
			flex-wrap: wrap;

			.li {
				margin: 18rpx 20rpx;
			}
		}

		.btn {
			position: fixed;
			bottom: 60rpx;
			left: 30rpx;
			width: 690rpx;
			height: 90rpx;
			line-height: 90rpx;
			text-align: center;
			background: #FBE43F;
			border-radius: 67rpx 67rpx 67rpx 67rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: #FFFFFF;
		}
	}
</style>